package com.lineage.william;

import com.lineage.DatabaseFactory;
import com.lineage.Server;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.utils.SQLUtil;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;

public class ArrowGfxid {
  private static ArrayList<ArrayList<Integer>> aData17 = new ArrayList<ArrayList<Integer>>();
  
  private static boolean NO_MORE_GET_DATA17 = false;
  
  public static final String TOKEN = ",";

private static String sTemp;
  
  public static void main(String[] a) {
    try {
      Server.main(null);
    } catch (Exception exception) {}
  }
  
  public static void forItemUSe(L1PcInstance user, int poly) {
    ArrayList<Integer> aTempData = null;
    if (!NO_MORE_GET_DATA17) {
      NO_MORE_GET_DATA17 = true;
      getData15b();
    } 
    int i = 0;
    while (i < aData17.size()) {
      aTempData = (ArrayList<Integer>) aData17.get(i);
      if (!user.hasSkillEffect(67)) {
        user.setpolyarrow(0);
      } else {
        if (((Integer)aTempData.get(0)).intValue() == poly && 
          user.getpolyarrow() != ((Integer)aTempData.get(1)).intValue()) {
          user.setpolyarrow(((Integer)aTempData.get(1)).intValue());
          break;
        } 
        user.setpolyarrow(66);
      } 
      i++;
    } 
  }
  
  private static void getData15b() {
    Connection con = null;
    try {
      con = DatabaseFactory.get().getConnection();
      Statement stat = con.createStatement();
      ResultSet rset = stat.executeQuery("SELECT * FROM w_变身箭矢特效");
      ArrayList<Integer> aReturn = null;
      sTemp = null;
      if (rset != null)
        while (rset.next()) {
          aReturn = new ArrayList<Integer>();
          aReturn.add(0, new Integer(rset.getInt("polyid")));
          aReturn.add(1, new Integer(rset.getInt("arrowgfxid")));
          aData17.add(aReturn);
        }  
      SQLUtil.close(rset);
      SQLUtil.close(stat);
      SQLUtil.close(con);
    } catch (Exception exception) {}
  }
}
